package Week1.J0420;

// 忘记下标从 0 开始！
public class 大数加法_xv {

    public String solve (String s, String t) {
        StringBuffer sbr = new StringBuffer();
        int sLen = s.length() - 1;
        int tLen = t.length() - 1;
        int tmp = 0;

        while (sLen >= 0 || tLen >= 0 || tmp != 0) {
            if (sLen >= 0) tmp += s.charAt(sLen--) - '0';
            if (tLen >= 0) tmp += t.charAt(tLen--) - '0';
            sbr.append(tmp % 10);
            tmp /= 10;
        }
        return sbr.reverse().toString();
    }
}
